import pytest
import requests
from config.config_read import read

# target = read()
@pytest.fixture(scope='session')
def crm_login():
    data = {'username':read().con_crm('username'),'password':read().con_crm('password')}
    print(data)
    crm_url = read().con_crm('url')
    time = int(read().con_crm('timeout'))
    a = requests.post(crm_url+'/login',data=data,timeout=time)
    results = a.json()
    token = results['Admin-Token']
    return token


# crm_login()


